//
//  RegistView.m
//  VEW
//
//  Created by lanou3g on 15/7/27.
//  Copyright (c) 2015年 Y团. All rights reserved.
//

#import "RegistView.h"
#import "LTView.h"


@interface RegistView ()
{
    UIScrollView * _bottomScrollView;
}

- (void)p_setupSubviews;
@end


@implementation RegistView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        [self p_setupSubviews];
        self.backgroundColor = [UIColor whiteColor];
        
    }
    return self;
}

- (void)p_setupSubviews
{
    UIImageView *imageview = [[UIImageView alloc] initWithFrame:self.bounds];
    imageview.image = [UIImage imageNamed:@"星空.jpg"];
    [self addSubview:imageview];
    
    _bottomScrollView  = [[UIScrollView alloc] initWithFrame:self.bounds];
    //    _bottomScrollView.contentSize = CGSizeMake(320, 1000);
    _bottomScrollView.scrollEnabled = NO;
    [self addSubview:_bottomScrollView];
    
    _usernameView = [[LTView alloc] initWithFrame:CGRectMake(50, 130, 280, 50) description:@"用户名：" placeholder:@"请输入用户名"];
    [_bottomScrollView addSubview:_usernameView];
    
    _passwordView = [[LTView alloc] initWithFrame:CGRectMake(50, 210, 280, 50) description:@"密码：" placeholder:@"请输入密码"];
    [_passwordView setSecureTextEnabled:YES];
    [_bottomScrollView addSubview:_passwordView];
    
    _confirmView = [[LTView alloc] initWithFrame:CGRectMake(50, 290, 280, 50) description:@"确认密码：" placeholder:@"再次输入密码"];
    [_confirmView setSecureTextEnabled:YES];
    [_bottomScrollView addSubview:_confirmView];
    
    _emailView = [[LTView alloc] initWithFrame:CGRectMake(50, 370, 280, 50) description:@"邮箱：" placeholder:@"请输入邮箱"];
    _emailView.inputField.keyboardType = UIKeyboardTypeEmailAddress;
    [_bottomScrollView addSubview:_emailView];
    
    _phoneNumberView = [[LTView alloc] initWithFrame:CGRectMake(50, 450, 280, 50) description:@"联系方式：" placeholder:@"请输入联系方式"];
    _phoneNumberView.inputField.keyboardType = UIKeyboardTypeNumberPad;
    [_bottomScrollView addSubview:_phoneNumberView];
    
    
    
    
}

//键盘显示
- (void)adjustSubviewsWithKeyboardShow
{
    
    _bottomScrollView.contentSize = CGSizeMake(320, self.bounds.size.height+20);
    _bottomScrollView.scrollEnabled = YES;
}

//键盘消失
- (void)adjustSubviewsWithKeyboardHide
{
    [UIView animateWithDuration:0.1 animations:^{
        
        _bottomScrollView.contentOffset = CGPointMake(0, -64);
        
    }];
    _bottomScrollView.scrollEnabled = NO;
    
}



@end
